﻿using System.Diagnostics;
using Grpc.Net.Client;
using Grpc.Reflection.V1Alpha;
using ServerReflectionClient = Grpc.Reflection.V1Alpha.ServerReflection.ServerReflectionClient;
using var channel = GrpcChannel.ForAddress("http://localhost:5222");
var client = new ServerReflectionClient(channel);


using var call = client.ServerReflectionInfo();
await call.RequestStream.WriteAsync(new ServerReflectionRequest()
{
    ListServices = "*" //拿到所有服务
});
Debug.Assert(await call.ResponseStream.MoveNext(CancellationToken.None));

var response = call.ResponseStream.Current;
await call.RequestStream.CompleteAsync();
Console.WriteLine(response);